/***************************************************************
 * Name:      IrReaderClientWindowsImpl.h
 * Purpose:   Windows Implementation of IrReader Client
 * Author:    Jimmy F.Klarke (isjfk@163.com)
 * Created:   2009-08-15
 * Copyright: Jimmy F.Klarke (http://www.isjfk.org)
 * License:
 **************************************************************/

#ifndef IRREADERCLIENTWINDOWS_H
#define IRREADERCLIENTWINDOWS_H

#include <windows.h>

#include <vector>
#include <string>

#include "IrReaderClient.h"

using namespace std;

class IrReaderClientWindowsImpl : public IrReaderClient
{
    public:

        IrReaderClientWindowsImpl();

        virtual vector<string> getPortList();
        virtual string getPortDefault();
        virtual vector<string> getBaudList();
        virtual string getBaudDefault();
        virtual vector<string> getDataBitSizeList();
        virtual string getDataBitSizeDefault();
        virtual vector<string> getStopBitSizeList();
        virtual string getStopBitSizeDefault();
        virtual vector<string> getParityList();
        virtual string getParityDefault();
        virtual vector<string> getFlowCtrlList();
        virtual string getFlowCtrlDefault();

        virtual void openClient(
                string port,
                string baud,
                string dataBitSize,
                string stopBitSize,
                string parity,
                string flowCtrl);
        virtual void closeClient();

        virtual vector<unsigned char> read();
        virtual void writeConfig();

    private:

        vector<string> portList;
        vector<string> baudList;
        vector<string> dataBitSizeList;
        vector<string> stopBitSizeList;
        vector<string> parityList;
        vector<string> flowCtrlList;

        HANDLE client;

};

string getErrorMsg(DWORD errorNo);

#endif // IRREADERCLIENTWINDOWS_H
